package day8;

/**
 * @author oldliu
 * @since 1.0
 */
public class Worker extends Thread  {
    public Worker(String n){
        super(n);
    }

    @Override
    public void run() {
         while (true){
             System.out.println("工人"+this.getName()+"干了一会活");
             try {
                 Thread.sleep(1000);
                 System.out.println("工人"+this.getName()+"睡到自然醒，继续干活");
             } catch (InterruptedException e) {
                 System.out.println(this.getName()+"被喊醒，继续干活");
                 e.printStackTrace();
             }
         }
    }
}
